/*
============================================================================
 Name        : Titlebar.h
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CTitlebar declaration
============================================================================
*/

#ifndef TITLEBAR_H
#define TITLEBAR_H

// INCLUDES
#include "Control.h"

// CLASS DECLARATION
class MTitlebarObserver
{
public:
	virtual void HandleTitlebarCommand(TInt aCommand) = 0;
};


class CTitlebar : public CControl
{
public:
	~CTitlebar();

	static CTitlebar* NewL();

	static CTitlebar* NewLC();

private:
	CTitlebar();

	void ConstructL();

public:
	virtual void Draw(CFbsBitGc& g);

	virtual TBool OnKeyDown(const TInt& keycode);

	void SetRect(const TInt& left,const TInt& top,const TInt& right, const TInt& bottom);

	virtual TBool OnMouseDown(const TPoint& aPt);

	virtual TBool OnMouseUp(const TPoint& aPt);

	void SetObserver(MTitlebarObserver* aObserver) {iObserver = aObserver;}

	void FocusChanged(TBool aFocus, const TInt keyCode = 0);

	void FocusEnabled(TBool aFocus);

	void SetTitleText(const TDesC& aText);
	
	void SetTitleText2(const TDesC& aText);

	TBool GetFocusEnabled() const {return iFoucusEnabled;}

public:
	enum {
	    Left,
		Right,
		Search
	};

private:
	MTitlebarObserver* iObserver;

	mutable TRect iLeftFocusRect;
	mutable TRect iRightFocusRect;
	mutable TRect iSearchRect;

	TBool iFoucusEnabled;
	TBool iFocusOnSearch;
	TBool iFocusOnGoodName;

	TBuf<16> iTitleText;
	TBuf<16> iTitleText2;
	CFont* iFont;

	CFbsBitmap* iLogo;
	CFbsBitmap* iLogomask;
	CFbsBitmap* iSearchBitmap;
	CFbsBitmap* iSearchBitmapmask;
	CFbsBitmap* iSearchFocusBitmap;
	CFbsBitmap* iSearchFocusBitmapmask;
	CFbsBitmap* iLeftarrowBitmap;
	CFbsBitmap* iLeftarrowBitmapmask;
	CFbsBitmap* iRightarrowBitmap;
	CFbsBitmap* iRightarrowBitmapmask;
};

#endif // TITLEBAR_H
